/// <reference types="node" />
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import { resolve } from 'path';
import AutoImport from 'unplugin-auto-import/vite';
import Components from 'unplugin-vue-components/vite';
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers';
import tailwindcss from '@tailwindcss/vite';
// https://vite.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    tailwindcss(),
    AutoImport({
      resolvers: [ElementPlusResolver()],
      imports: ['vue', 'vue-router'], // 自动导入 vue 和 vue-router相关函数
      dts: 'src/auto-imports.d.ts', // 生成 `auto-imports.d.ts` 全局声明
    }),
    Components({
      dirs: ['src/components', 'src/layouts/components'],
      resolvers: [ElementPlusResolver()],
      dts: 'src/components.d.ts', // 生成类型声明文件
    }),
  ],
  resolve: {
    alias: {
      '@': resolve(__dirname, 'src'),
    },
  },
});
